//
//  YBSecretaryListDetailInfoTableViewCell.m
//  ShangHaiHuDongApp
//
//  Created by apple on 17/8/28.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "YBSecretaryListDetailInfoTableViewCell.h"

@implementation YBSecretaryListDetailInfoTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initMyCell];
    }
    return self;
}

-(void)initMyCell{
    [self.contentView addSubview:self.cellTitleLabel];
    [self.contentView addSubview:self.needNumberLabel];
    [self.contentView addSubview:self.assetNumberLabel];
    [self.contentView addSubview:self.cellDetailInfoLabel];
    [self.contentView addSubview:self.addressLabel];
    
    self.cellTitleLabel.sd_layout.leftSpaceToView(self.contentView , 24 * ItemWidth).topSpaceToView(self.contentView , 40 * ItemHeight).widthIs([UIScreen zj_screenWith] - 48 * ItemWidth).heightIs(1);
    
    self.needNumberLabel.sd_layout.leftSpaceToView(self.contentView , 24 * ItemWidth).topSpaceToView(self.cellTitleLabel , 20 * ItemHeight).widthIs(1).heightIs(38 * ItemHeight);
    
    self.assetNumberLabel.sd_layout.leftSpaceToView(self.needNumberLabel , 0).topSpaceToView(self.cellTitleLabel , 20 * ItemHeight).widthIs([UIScreen zj_screenWith] / 2).heightIs(38 * ItemHeight);
    
    self.cellDetailInfoLabel.sd_layout.leftSpaceToView(self.contentView , 24 * ItemWidth).topSpaceToView(self.needNumberLabel , 30 * ItemHeight).widthIs([UIScreen zj_screenWith] - 48 * ItemWidth).heightIs(1);
    
    self.addressLabel.sd_layout.leftSpaceToView(self.contentView , 24 * ItemWidth).topSpaceToView(self.cellDetailInfoLabel , 15 * ItemHeight).widthIs([UIScreen zj_screenWith] - 48 * ItemWidth).heightIs(50 * ItemHeight);
}


-(void)reloadCellSizeWithTitleHeight:(CGSize)titleHeight needWidth:(CGFloat)needWidth detailInfoHeight:(CGSize)detailInfoHeight{
    self.cellTitleLabel.sd_layout.leftSpaceToView(self.contentView , 24 * ItemWidth).topSpaceToView(self.contentView , 40 * ItemHeight).widthIs(titleHeight.width).heightIs(titleHeight.height);
    [self.cellTitleLabel updateLayout];
    
    self.needNumberLabel.sd_layout.leftSpaceToView(self.contentView , 24 * ItemWidth).topSpaceToView(self.cellTitleLabel , 20 * ItemHeight).widthIs(needWidth + 38 * ItemWidth).heightIs(38 * ItemHeight);
    [self.needNumberLabel updateLayout];
    
    self.cellDetailInfoLabel.sd_layout.leftSpaceToView(self.contentView , 24 * ItemWidth).topSpaceToView(self.needNumberLabel , 30 * ItemHeight).widthIs(detailInfoHeight.width).heightIs(detailInfoHeight.height);
    [self.cellDetailInfoLabel updateLayout];
}

-(UILabel *)cellTitleLabel
{
    if (!_cellTitleLabel) {
        _cellTitleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _cellTitleLabel.font = [UIFont systemFontOfSize:15 * [UIScreen zj_textFontScale] weight:UIFontWeightHeavy];
        _cellTitleLabel.numberOfLines = 0;
        _cellTitleLabel.textColor = [UIColor textBlackColor];
    }
    return _cellTitleLabel;
}

-(UILabel *)needNumberLabel
{
    if (!_needNumberLabel) {
        _needNumberLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _needNumberLabel.font = [UIFont titleTextFont];
        _needNumberLabel.textColor = [UIColor textBlackColor];
    }
    return _needNumberLabel;
}

-(UILabel *)assetNumberLabel
{
    if (!_assetNumberLabel) {
        _assetNumberLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _assetNumberLabel.font = [UIFont titleTextFont];
        _assetNumberLabel.textColor = [UIColor textBlackColor];
    }
    return _assetNumberLabel;
}


-(UILabel *)cellDetailInfoLabel
{
    if (!_cellDetailInfoLabel) {
        _cellDetailInfoLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _cellDetailInfoLabel.font = [UIFont titleTextFont];
        _cellDetailInfoLabel.numberOfLines = 0;
        _cellDetailInfoLabel.textColor = [UIColor textBlackColor];
    }
    return _cellDetailInfoLabel;
}

-(UILabel *)addressLabel
{
    if (!_addressLabel) {
        _addressLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _addressLabel.font = [UIFont systemFontOfSize:13 * [UIScreen zj_textFontScale]];
        _addressLabel.numberOfLines = 0;
        _addressLabel.textColor = [UIColor zj_colorWithHexString:@"a9a9a9"];
    }
    return _addressLabel;
}


@end
